﻿using System;

namespace RexToy.UI.Controls
{
    public class ListDevider : ListViewItem
    {
        public override bool Clickable
        {
            get { return false; }
        }

        private string __text;
        public string Text
        {
            get { return __text; }
            set
            {
                this.__text = value;
                var dom = this.__domNode.SearchByName("content");
                dom._element.InnerHTML = value;
            }
        }

        public override Palette Palette
        {
            get
            {
                return __palette;
            }
            set
            {
                var template = "ui-bar-{0}";
                this.__domNode.ReplaceClass(StringExt.Format(template, this.__palette), StringExt.Format(template, value));
                this.__palette = value;
            }
        }

        public ListDevider(string text)
        {
            this.__palette = Palette.B;
            this.__text = text;
            this.__domNode = RexToy.UI.Controls.DomNode.Create(new DomNodeCreateOptions()
            {
                tag = Tag.Li,
                hashName = "content",
                className = "ui-li ui-li-divider ui-btn ui-btn-up-b",
                innerHTML = this.__text
            });
            this.Palette = __palette;
        }
    }
}
